package cn.elves.model.activity.service.stateflow.impl;

import cn.elves.model.activity.service.stateflow.StateHandle;
import cn.elves.model.activity.service.stateflow.StateHandlerSelector;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class StateHandler implements StateHandle {

    @Resource
    private StateHandlerSelector stateHandlerSelector;

    @Override
    public Boolean doArraignment(Long activityId, Integer curState) {
        return stateHandlerSelector.stateGroup.get(curState).doArraignment(activityId,curState);
    }

    @Override
    public Boolean doCheckPass(Long activityId, Integer curState) {
        return stateHandlerSelector.stateGroup.get(curState).doCheckPass(activityId,curState);
    }

    @Override
    public Boolean doCheckRefuse(Long activityId, Integer curState) {
        return stateHandlerSelector.stateGroup.get(curState).doCheckRefuse(activityId,curState);
    }

    @Override
    public Boolean doCheckRevoke(Long activityId, Integer curState) {
        return stateHandlerSelector.stateGroup.get(curState).doCheckRevoke(activityId,curState);
    }

    @Override
    public Boolean doClose(Long activityId, Integer curState) {
        return stateHandlerSelector.stateGroup.get(curState).doClose(activityId,curState);
    }

    @Override
    public Boolean doOpen(Long activityId, Integer curState) {
        return stateHandlerSelector.stateGroup.get(curState).doOpen(activityId,curState);
    }

    @Override
    public Boolean doDoing(Long activityId, Integer curState) {
        return stateHandlerSelector.stateGroup.get(curState).doDoing(activityId,curState);
    }
}
